<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta name="copyright" content="http://www.appcms.org" />
<link rel="stylesheet" href="skin/base.css">
<link rel="stylesheet" href="skin/company_list.css">
<script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/zy_slide.js"></script>
<script src="js/config.js"></script>
<script src="js/common.js"></script>
</head>
<body>
<div id="main">
  <div class="company_list" id="company_list"> </div>
</div>
</body>
<script>
	zy_init();
	var page=1;	
	function getmain(t){
		if (t<=0){
			page=1;
		}
		if(t==-1){
			$$('main').className="loading";
		}
		getLocation();
		var catid = localStorage['company_catid'];
		localStorage['order'] = 'hot';
		var url = app_path+'index.php?m=iappYp&c=app&a=lists&t=iappYp_company&catid='+catid+'&lng='+localStorage['lng']+'&lat='+localStorage['lat']+'&order='+localStorage['order']+'&page='+page;
		uexXmlHttpMgr.open(t,'post',url,"8000");
		uexXmlHttpMgr.send(t);
	}
	window.uexOnload=function(type){
		if(!type){
			
			uexWindow.setBounce("1");
			uexWindow.setBounceParams("1",'{"textColor":"#666","levelText":"","pullToReloadText":"加载更多","releaseToReloadText":"释放加载","loadingText":"加载中，请稍等"}');
			uexWindow.showBounceView("0","#f3f3f3","1");
　　　　		uexWindow.notifyBounceEvent("0","1");
			uexWindow.showBounceView("1","#f3f3f3","1");
　　　　		uexWindow.notifyBounceEvent("1","1");
			uexWindow.onBounceStateChange=function(t,s){
	　　　　　　	if(t=="0"||t=="1"){
	　　　　　　　　	if(s=="2"){
						getmain(t);						
					}
	　　　　　　	}
	　　　　	}
	
			uexXmlHttpMgr.onData = function(opId, status, data){
				uexXmlHttpMgr.close(opId);
				uexWindow.resetBounceView(opId);
				if(status==1){
					$$("main").className = '';
					data = JSON.parse(data);
					if(opId<=0){					
						$$('company_list').innerHTML='';
						uexWindow.setBounceParams("0",'{"textColor":"#666","levelText":"上次更新：'+Now()+'","pullToReloadText":"拖动刷新","releaseToReloadText":"释放刷新","loadingText":"加载中，请稍等"}');
					}	
					var List = data['list'];
					if (List.length > 0) {
						for (i = 0; i < List.length; i++) {
							var div=document.createElement("div");
							div.className='item';
							div.setAttribute("onclick", "javascript:jump("+List[i]['id']+","+List[i]['catid']+");");
							div.setAttribute("ontouchstart", "javascript:zy_touch('down');");
							var html = ''
							html += '<div class="logo"><div class="loadimg"><img src="'+List[i]['thumb']+'" class="hide" onload="this.className=\'\'" /></div></div>';
							html += '<div class="txt">';
							html += '<strong>' + List[i]['title'] + '</strong>';
							html += '<span class="tel">电话：'+List[i]['tel']+'</span>';
							html += '<span>' + List[i]['areaname'] + ' ' + List[i]['catname'] + '</span>';
							if (List[i]['distance']) {
								html += '<em>' + List[i]['distance'] + '</em>';
							}
							html += '</div>';
							
							div.innerHTML = html;
							$$('company_list').appendChild(div);
						}
						page++;
					}else{
						uexWindow.toast("0","5",'没有更多数据~',2000);
					}
				}else if(status ==-1) {
					if (opId <= 0) {
						$$("company_list").innerHTML = '';
						$$("main").className = 'errer';
						uexWindow.toast("0","5",'加载失败~',2000);
					}else{
						uexWindow.toast("0","5",'更多加载失败~',2000);
					}
				}
			}
			getmain(-1);
		}
	}
	
	function jump(id,catid){
		localStorage['company_id']=id;
		uexWindow.open('company_show','0','company_show.html','2','', '',0);
	}
	
	</script>
</html>